﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Locations.aspx.cs" Inherits="TicketingCompany.Locations" %>
<asp:Content ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager ID="ScriptManager" runat="server" />
    
    <asp:GridView ID="GridViewLocations" runat="server" AllowPaging="True" AllowSorting="True" 
        AutoGenerateColumns="False" DataKeyNames="LocationID" 
        DataSourceID="EntityDataSource" onrowdeleting="OnGridView_RowDeleting" OnRowUpdating="OnGridView_RowUpdating" >
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />            
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
        </Columns>        
    </asp:GridView>
    <asp:Label ID="LabelDeleteInfo" ForeColor=Red Text="" runat="server" />
    <br />
    <asp:EntityDataSource ID="EntityDataSource" runat="server" 
        ConnectionString="name=TicketingCompanyEntities" 
        DefaultContainerName="TicketingCompanyEntities" EnableDelete="True" 
        EnableFlattening="False" EnableInsert="True" EnableUpdate="True" 
        EntitySetName="Locations">
    </asp:EntityDataSource>
    
    <br />
    <asp:Button ID="ButtonShowCreateLocationPanel" Text="Create Location" 
        runat="server" onclick="ButtonShowCreateLocationPanel_Click" />
    <asp:Panel ID="PanelCreateLocation" runat="server" Visible="false">
        <asp:TextBox ID="TextBoxLocationName" runat="server" />
        <asp:Button ID="ButtonCreateLocation" Text="Create" runat="server" 
            onclick="ButtonCreateLocation_Click"  />
        <asp:Label ID="LabelErrorCreate" Text="The Location Name should be between 1 and 50 symbols"
            runat="server" ForeColor="Red" Visible="false" />
    </asp:Panel>
</asp:Content>
